<%@ page language="java" %>

<%@ page import="java.util.ArrayList,
                 java.util.HashMap,
                 java.util.Iterator,
                 com.scalar.chiptrack.operations.process.VendorLocation,
                 com.scalar.chiptrack.operations.process.BoardMaking,
                 com.scalar.chiptrack.operations.process.dao.PartNumber,
                 com.scalar.chiptrack.operations.process.forms.BoardKitForm,
                 com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User,
                 org.apache.struts.util.LabelValueBean,
                 com.scalar.chiptrack.operations.process.BomRevSchemaFile"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/kitMaking.do?action=processType" />

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<% BoardKitForm kitMakingForm = (BoardKitForm)request.getAttribute("kitMakingForm");%>

<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" onload = "javascript:setRadio()">

<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/kit_making.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>


<SCRIPT language="JavaScript">
var prevPrice = 0;
var bomFileName = new Array();
var schemaFileName = new Array();
var bomNum = new Array();
var schemaNum = new Array();
var bomSize = 0;
var schemaSize = 0;

    <%
        if( session.getAttribute("kitMakingForm") != null )
        {
            BoardKitForm boardKitForm    = (BoardKitForm)session.getAttribute("kitMakingForm");
            ArrayList bomRevFileList =    ( ArrayList) boardKitForm.getBomRevFileList();
            out.println("bomSize="+bomRevFileList.size() );
            for( int i = 0 ; i < bomRevFileList.size() ; i++)
            {
                 BomRevSchemaFile bomRevFile = ( BomRevSchemaFile )bomRevFileList.get(i);
                 out.println("bomFileName["+i+"]="+"'"+bomRevFile.getFileName()+"'" );
                 out.println("bomNum["+i+"]="+"'"+bomRevFile.getBomOrSchemaNumber().trim()+"'" );
            }
            ArrayList schemaFileList =    ( ArrayList) boardKitForm.getSchematicFileList();
            out.println("schemaSize="+schemaFileList.size() );
            for( int i = 0 ; i < schemaFileList.size() ; i++)
            {
                 BomRevSchemaFile schemaFile = ( BomRevSchemaFile )schemaFileList.get(i);
                 out.println("schemaFileName["+i+"]="+"'"+schemaFile.getFileName()+"'" );
                 out.println("schemaNum["+i+"]="+"'"+schemaFile.getBomOrSchemaNumber().trim()+"'" );
            }
        }
    %>



    function setRadio()
    {
        var form = document.kitMakingForm;
       /* if( form.productType.value == "BOARD")
        {
           form.productType.checked="checked";
        }*/
        <%
            String duplicateChildPartNumber = "";
            duplicateChildPartNumber = (String)request.getAttribute("dupPartNumber");
            if( duplicateChildPartNumber == null ){
            duplicateChildPartNumber = "";
            }
        %>
        <%if( ( duplicateChildPartNumber != "" )&&( duplicateChildPartNumber.length() > 0 ) )
        {%>
            if( document.kitMakingForm.childBoardName != null )
            {
                if( document.kitMakingForm.childBoardName.length == null  )
                {
                     if( document.kitMakingForm.childBoardName.value == '<%= duplicateChildPartNumber%>' )
                        {
                            document.kitMakingForm.childBoardName.disabled = false;
                            document.kitMakingForm.childBoardName.focus();
                        }
                }
                else
                {
                    for(var i = 0; i < form.childBoardName.length; i++ )
                    {
                        if( document.kitMakingForm.childBoardName[i].value == '<%= duplicateChildPartNumber%>' )
                        {
                            document.kitMakingForm.childBoardName[i].disabled = false;
                            document.kitMakingForm.childBoardName[i].focus();
                        }
                    }
                 }
              }
        <%}%>

        if( document.kitMakingForm.childBoardName != null )
        {
            if( document.kitMakingForm.childBoardName.length == null )
            {
                if( document.kitMakingForm.childBoardName.value == '' )
                {
                    document.kitMakingForm.childBoardName.disabled = false;
                }
            }
            else
            {
                for(var i = 0; i < document.kitMakingForm.childBoardName.length; i++ )
                {
                    if( document.kitMakingForm.childBoardName[i].value == '' )
                    {
                        document.kitMakingForm.childBoardName[i].disabled = false;
                    }
                }
             }
         }
    }

	var focusNum = 0;
    function submitPage(action)
    {
        var pa	= document.getElementById("errors");
        var form = document.kitMakingForm;
		pa.innerHTML = '';
        if(action == 'OPEN')
		{
            var errors = '';
            var pa = document.getElementById("errors");
            if ((form.productId.value == '0')|| (form.productId.value == '-1'))
			{
                pa.innerHTML = "<li> Please select a valid Part Number " ;
                return;
            }
			form.action.value = "OpenBaordMaking";
            form.submit();
        }
		else if( action == 'SAVE' )
		{
			if ((form.productId.value == '0')|| (form.productId.value == '-1'))
			{
				pa.innerHTML = "<li> Please select a valid Part Number " ;
				return;
			}

			if( form.partNumber.value.trim().length < 1)
			{
			    pa.innerHTML = "<li> Please enter Board/Kit Part Number ";
				form.partNumber.value="";
                form.partNumber.focus();
                return;
		   }
           //added by varma (08/sep/2004)
           if( form.partNumber.value.indexOf("'") >= 0 )
           {
                pa.innerHTML = "<li> Please enter Board/Kit Part Number without single quotes "
                form.partNumber.select();
                form.partNumber.focus();
                return;
           }
           if( form.partNumber.value.indexOf('"') >= 0 )
           {
                pa.innerHTML = "<li> Please enter Board/Kit Part Number without double quotes "
                form.partNumber.select();
                form.partNumber.focus();
                return;
           }//till here
			form.unitPrice.value = form.unitPrice.value.trim();
			if ( form.unitPrice.value == '0' )
			{
				form.unitPrice.value = '0.0';
			}


			if ( checkFloat ( form.unitPrice.value,' Unit Price ','Y'  ) == false )
			{
				pa.innerHTML = errMsg;
				form.unitPrice.focus();
				return;
			}

            if(form.unitPrice.value != '')
            {
                var j = 0;
                for(var k = 0; k < (form.unitPrice.value).length;k++)
                {
                    var c = (form.unitPrice.value).charAt(k);
                    if( c == '.' )
                    {
                        j++;
                        if(j > 1 )
                        {
                            pa.innerHTML = "<li> Please enter a valid Unit Price";
                            form.unitPrice.select();
                            return;
                        }
                    }
               }
               if(check_char_position4(form.unitPrice.value) || (is_Sp_Characters_frieght(form.unitPrice.value) == false)  )
               {
                     pa.innerHTML = "<li> Please enter a valid Unit Price";
                     form.unitPrice.select();
                     return;
               }
               if( (form.unitPrice.value).length >= 7 )
                {
                    var priceValue = form.unitPrice.value;
                    var index = priceValue.indexOf(".");
                    if( index == -1 || index > 6 )
                    {
                        pa.innerHTML = "<li> Please enter a valid Unit Price (price should be in XXXXXX.XX format)";
                        form.unitPrice.select();
                        return;
                    }

                }
            }

           if ( !vendorValidations(form) )
           {
                pa.innerHTML = "<li> Please select atleast one vendor";
                return;
           }


			if ( !checkPartNumber () )
			{
				pa.innerHTML = "<li> Parent part number "+form.partNumber.value+" and Child Board/Kit number "+form.partNumber.value+" cannot be same";

				return;
			}
			if ( !checkDeletion () )
			{
				pa.innerHTML = "<li> Child Board/Kit once created cannot be deleted";
				return;
			}

			focusNum = checkChildPartNumbers ();

			if ( parseInt ( focusNum ) != -1 )
			{
				pa.innerHTML = "<li> Child Board/Kit numbers cannot be same";
				form.childBoardName[focusNum].focus();
				return;
			}

            // added by saravnan
			/*
            if ( trim(form.schematic.value)  != "" )
            {
                pa.innerHTML = "<li>"+"Please click Attach to add Schematic file in to list before submitting";
                return;
            }

            if ( trim(form.bomRevNo.value)  != "" )
            {
                pa.innerHTML = "<li>"+"Please click Attach to add  BOM Rev file in to list before submitting";
                return;
            }
			*/


            //-----------------

			//-------------------
			//chakravarthy

				document.kitMakingForm.partNumber.disabled = false;

				for ( var i = 0; i < document.kitMakingForm.productType.length; i++)
				{
					document.kitMakingForm.productType[0].disabled  = false;
					document.kitMakingForm.productType[1].disabled  = false;
				}

			//-------------------


            if( document.kitMakingForm.childBoardName != null )
            {
                if( document.kitMakingForm.childBoardName.length == null )
                {
                    document.kitMakingForm.childBoardName.disabled = false;
                }
                else
                {
                    for(var i = 0; i < form.childBoardName.length; i++ )
                    {
                        document.kitMakingForm.childBoardName[i].disabled = false;
                    }
                }
            }

			//This is a very important condition. Please dont delete this as it may fire a
			//NullPointerException on the browser.
			form.action.value = "SaveBoardMaking";
            //alert( "action value set" );
            if ( checkValuesForBoardMaking () )
			{
				form.submit();
			}
        }
    }


	function addChildBoards()
	{
		var count = 0;
		var form = document.kitMakingForm;
		var pa = document.getElementById("childProductId");
		if ( pa == null )
		{
			count = 0;
		}
		else if ( form.childProductId.length == null )
		{
			count = 1;
		}
		else
		{
			count = parseInt(form.childProductId.length);
		}
		//'<table width ="100%" border="1"></table>'
        var htmltext ='<table width ="100%" border="0"><tr><td width="28%" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Child Board/Kit '+(count+1)+':</td>';
            htmltext = htmltext + '<td class="NArialL" width="32%">&nbsp;<input type="text" name="childBoardName" value="" class="txfield">';
			htmltext = htmltext + '<input type="hidden" name="childProductId" value="-1">';
			htmltext = htmltext + '<input type="hidden" name="originalChildBoardName" value="">';
            htmltext = htmltext + '</td><td class="NArialL" width="40%">&nbsp;</td></tr></table>';

	    var pa=document.getElementById("font1");
        pa.insertAdjacentHTML('BeforeEnd',htmltext);
    }

    function checkChildBoards ()
	{
		var bool = false;
		var form = document.kitMakingForm;
		var pa = document.getElementById("childProductId");
		if ( pa == null )
		{
			bool = false;
		}
		else if ( form.childProductId.length == null )
		{
			if ( ( form.originalChildBoardName.value.trim().length == 0 ) && ( form.childBoardName.value.trim().length == 0 ) )
			{
				bool = false;
			}
			else if ( ( form.originalChildBoardName.value.trim().length > 0 ) && ( form.childBoardName.value.trim().length == 0 ) )
			{
				bool = false;
			}
			else
			{
				bool = true;
			}
		}
		else
		{
			for (var aa = 0; aa < form.childProductId.length; aa++ )
			{
				if ( form.childBoardName[aa].value.trim().length > 0 )
				{
					bool = true;
				}
			}
		}
		return bool;
	}


	/*
	This method must be called only after the checkChildBoards. The reason can be
	attributed to the presence of old records in database without any child records.
	*/
	function checkPartNumber ()
	{
		var bool = true;
		var form = document.kitMakingForm;
		var parentPartNumber = form.partNumber.value;

		if( form.childProductId != null)
		{
			if ( form.childProductId.length == null )
			{
				if ( parentPartNumber.toUpperCase() == form.childBoardName.value.toUpperCase().trim() )
				{
					bool = false;
				}
			}
			else
			{
				for ( var aa = 0; aa < form.childProductId.length; aa++ )
				{
					if ( parentPartNumber.toUpperCase() == form.childBoardName[aa].value.toUpperCase().trim() )
					{
						focusNum = aa;
						bool = false;
					}
				}
			}
		}
		return bool;
	}

	function checkChildPartNumbers ()
	{
		var bool = -1;
		var form = document.kitMakingForm;

		if( form.childProductId != null)
		{
			if ( form.childProductId.length == null )
			{
				bool = -1;
			}
			else
			{
				for (var aa = 0; aa < form.childProductId.length; aa++ )
				{
					form.childBoardName[aa].value = form.childBoardName[aa].value.trim();
					for (var bb = 0; bb < form.childProductId.length; bb++ )
					{
						form.childBoardName[bb].value = form.childBoardName[bb].value.trim();
						if ( parseInt ( aa ) != parseInt ( bb ) )
						{
							if ( form.childBoardName[aa].value.trim().length > 0 && form.childBoardName[bb].value.trim().length > 0 )
							{
								if ( form.childBoardName[aa].value.toUpperCase().trim() == form.childBoardName[bb].value.toUpperCase().trim() )
								{
									bool = aa;
								}
							}
						}
					}
				}
			}
		}
		return bool;
	}

	function checkDeletion ()
	{
		var bool = true;
		var form = document.kitMakingForm;

		if( form.childProductId != null)
		{
			if ( form.childProductId.length == null )
			{
				if ( form.childProductId.value == '-1' )
				{
					return true;
				}
				else
				{
					if ( ( form.childBoardName.value.trim().length == 0 ) && ( form.originalChildBoardName.value.trim().length > 0 ) )
					{
						form.childBoardName.value = form.originalChildBoardName.value;
						form.childBoardName.focus();
						bool = false;
					}
				}
				//return true;
			}
			else
			{
				for ( var aa = 0; aa < form.childProductId.length; aa++ )
				{
                    if ( ( form.childBoardName[aa].value.trim().length == 0 ) && ( form.originalChildBoardName[aa].value.trim().length > 0 ) )
                    {
                        form.childBoardName[aa].value = form.originalChildBoardName[aa].value;
                        form.childBoardName[aa].focus();
                        bool = false;
                    }
				}
			}
		}
		return bool;
	}

	function addBomFiles(  )
	{

       // commented by saravnan
       //***********************************
		/*var count = 0;
		var form = document.kitMakingForm;
		var addfile = document.getElementById("bomRevNo");
		count = parseInt(form.bomRevNo.length);

		//alert(count);
		if ( addfile == null )
		{
			count = 0;
		}
		else if ( form.bomRevNo.length == null )
		{
			count = 0;
		}
		else
		{
			count = parseInt(form.bomRevNo.length);
			//alert(count);
		}

		//alert(count);
		var htmltext ='<br><tr><td width="28%" class="NArialL">File :&nbsp;&nbsp;</td>';
            htmltext = htmltext + '<td class="NArialL" width="10%"><input type="file"  name="bomRevNo" value= "" class="txfield" size="10"/>';
			htmltext = htmltext + '<input type="hidden" name="bomRevNo" value="-1">';
            htmltext = htmltext + '</td><td class="NArialL" width="40%">&nbsp;</td></tr><br>';

	    var addfile=document.getElementById("font2");
        addfile.insertAdjacentHTML('BeforeEnd',htmltext);*/
        //***********************************//


        // Added by saravnan
        var bomRevFileDetails = new Array();
        var bomRevFileDetailsSize = 0;

        <%
            if( request.getAttribute( "BomRevFileDetailsList") != null )
            {
                ArrayList  bomRevFileDetailsList = (ArrayList ) request.getAttribute( "BomRevFileDetailsList") ;
                out.println( "bomRevFileDetailsSize="+bomRevFileDetailsList.size() );
                for( int i=0 ; i < bomRevFileDetailsList.size() ; i++ )
                {
                   LabelValueBean lb = (LabelValueBean) bomRevFileDetailsList.get( i );
                   out.println( "bomRevFileDetails["+i+"]="+"'"+lb.getLabel().trim()+"'" );
                }

            }
        %>
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "addmoreBomRevFiles";
        if( form.bomRevNo.value  == "" )
        {
            pa.innerHTML ='<li>'+"Please select a BOM Rev file to add in to list";
            return;
        }
        if( form.bomRevNo.value.indexOf("'") >= 0 )
        {
            pa.innerHTML ='<li>'+"Please enter BOM Rev filename without Single Quotes";
            return;
        }
        var bomRevNoValue = form.bomRevNo.value;
        var position = bomRevNoValue.lastIndexOf( '\\' );
        var fileName = bomRevNoValue.substr(  (position+1) , bomRevNoValue.length )
        for( var i =0 ; i < bomRevFileDetailsSize ; i ++ )
        {
           if( fileName.toLowerCase() == bomRevFileDetails[i].toLowerCase() )
           {
              pa.innerHTML ='<li>'+"BOM Rev file already present in the list cannot be added";
              return;
           }
        }

        // Added By Suresh Yeruva on [26 AUG 2004]
        var noOfRows = form.noOfRowsBOMRev.value;
        for( var counter = 0 ; counter < noOfRows ; counter ++ )
        {
            var savedBomRevFile = form['bomRevFiles.fileList[' + counter + '].filename'].value;
            var bomRevFilePosition  = savedBomRevFile.lastIndexOf( ')' );
            var savedBomRevFileName  = savedBomRevFile.substr ( ( bomRevFilePosition + 1 ) , savedBomRevFile.length )
            if( fileName.toLowerCase() == savedBomRevFileName.toLowerCase() )
            {
              pa.innerHTML ='<li>'+"BOM Rev file already present in the list cannot be added";
              return;
            }
        }

        if( form.bomRevNumber.value.trim()  == "" )
        {   form.bomRevNumber.value = "";
            pa.innerHTML ='<li>'+"Please enter BOM Rev Number";
            return;
        }

        for( var counter = 0 ; counter < bomSize ; counter ++ )
        {
           if( form.bomRevNumber.value.trim().toLowerCase() == bomNum[counter].trim().toLowerCase() )
           {
                pa.innerHTML ='<li>'+"BOM Rev Number already exists cannot be added";
                return;
           }
        }

        for ( var counter = 0; counter < noOfRows ; counter++ )
        {
            if ( form['bomRevFiles.fileList[' + counter + '].bomRevOrSchemNum'].value.trim().toLowerCase() == form.bomRevNumber.value.trim().toLowerCase() )
            {
                pa.innerHTML ='<li>'+"BOM Rev Number already exists cannot be added";
                return;
            }
        }
        // Ended By Suresh Yeruva

        if ( checkValuesForBoardMaking () )
		{
			form.submit();
		}



    }

	function addSchemFiles( )
	{
       // Commented by saravnan
      //***********************************//
		/*var count = 0;
		var form = document.kitMakingForm;
		var addfile = document.getElementById("schematicNumber");
		var htmltext ='<br><tr><td width="28%" class="NArialL">File :&nbsp;&nbsp;</td>';
            htmltext = htmltext + '<td class="NArialL" width="10%"><input type="file"  name="schematicNumber" value= "" class="txfield" size="10"/>';
			htmltext = htmltext + '<input type="hidden" name="schematicNumber" value="-1">';
            htmltext = htmltext + '</td><td class="NArialL" width="40%">&nbsp;</td></tr>';
            htmltext = htmltext + '</td><td class="NArialL" width="40%">&nbsp;</td></tr>';

	    var addfile=document.getElementById("font3");
        addfile.insertAdjacentHTML('BeforeEnd',htmltext);*/

        //***********************************//

        //Added by saravnan
        var schemaFileDetails = new Array();
        var schemaFileDetailsSize = 0;

        <%
            if( request.getAttribute( "SchemaFileDetailsList") != null )
            {
                ArrayList  schemaFileDetailsList = (ArrayList ) request.getAttribute( "SchemaFileDetailsList") ;
                out.println( "schemaFileDetailsSize="+schemaFileDetailsList.size() );
                for( int i=0 ; i < schemaFileDetailsList.size() ; i++ )
                {
                   LabelValueBean lb = (LabelValueBean) schemaFileDetailsList.get( i );
                   out.println( "schemaFileDetails["+i+"]="+"'"+lb.getLabel().trim()+"'" );
                }

            }
        %>
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "addmoreSchemFiles";
        if( form.schematic.value  == "" )
        {
            pa.innerHTML ='<li>'+"Please select a Schematic file to add in to list";
            return;
        }
        if( form.schematic.value.indexOf("'") >= 0 )
        {
            pa.innerHTML ='<li>'+"Please enter Schematic filename without Single Quotes";
            return;
        }
        var schematicValue = form.schematic.value;
        var position = schematicValue.lastIndexOf( '\\' );
        var fileName = schematicValue.substr(  (position+1) , schematicValue.length )
        for( var i =0 ; i < schemaFileDetailsSize ; i ++ )
        {
           if( fileName.toLowerCase() == schemaFileDetails[i].toLowerCase() )
           {
              pa.innerHTML ='<li>'+"Schematic file already present in the list cannot be added";
              return;
           }
        }

        // Added By Suresh Yeruva on [26 AUG 2004]
        var noOfRows = form.noOfRowsSchematic.value;
        for( var counter = 0 ; counter < noOfRows ; counter ++ )
        {
            var savedSchematicFile = form['schmaFiles.fileList[' + counter + '].filename'].value;
            var schematicFilePosition  = savedSchematicFile.lastIndexOf( ')' );
            var savedSchematicFileName  = savedSchematicFile.substr ( ( schematicFilePosition + 1 ) , savedSchematicFile.length )
            if( fileName.toLowerCase() == savedSchematicFileName.toLowerCase() )
            {
              pa.innerHTML ='<li>'+"Schematic file already present in the list cannot be added";
              return;
            }
        }

        if( form.schematicNumber.value.trim()  == "" )
        {   form.schematicNumber.value = "";
            pa.innerHTML ='<li>'+"Please enter Schematic Number";
            return;
        }

        for( var counter = 0 ; counter < schemaSize ; counter ++ )
        {
           if( form.schematicNumber.value.trim().toLowerCase() == schemaNum[counter].trim().toLowerCase() )
           {
                pa.innerHTML ='<li>'+"Schematic Number already exists cannot be added";
                return;
           }
        }

        for ( var counter = 0; counter < noOfRows ; counter++ )
        {
            if ( form['schmaFiles.fileList[' + counter + '].bomRevOrSchemNum'].value.trim().toLowerCase() == form.schematicNumber.value.trim().toLowerCase() )
            {
                pa.innerHTML ='<li>'+"Schematic Number already exists cannot be added";
                return;
            }
        }
        // Ended By Suresh Yeruva

        if ( checkValuesForBoardMaking ()  )
		{
				form.submit();
		}

    }

    // Added by saravnan
    function removeBomRevFiles()
	{
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "removeBomRevFiles";

        if( document.kitMakingForm.bomRevFileDetails.value == "---BOM Rev Files---")
        {
           pa.innerHTML ='<li>'+"Please select a BOM Rev file to remove from list";
           return;
        }
        if ( checkValuesForBoardMaking ()  )
		{
			form.submit();
		}

    }

    // Added by saravnan
    function removeSchemaFiles()
	{
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "removeSchemFiles";

        if( document.kitMakingForm.schematicFileDetails.value == "---Schematic Files---")
        {
           pa.innerHTML ='<li>'+"Please select a Schematic file to remove from list";
           return;
        }
        if ( checkValuesForBoardMaking ()  )
		{
			form.submit();
		}

    }


    // Added by saravnan
    function modifyBomRevFiles()
	{
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "ModifyBomRevFiles";

        if( document.kitMakingForm.bomRevFileDetails.value == "---BOM Rev Files---")
        {
           pa.innerHTML ='<li>'+"Please select a BOM Rev file to modify from list";
           return;
        }

        // Added By Suresh Yeruva on [26 AUG 2004]
        var noOfRows = form.noOfRowsBOMRev.value;
        if( form.bomRevNumber.value.trim()  == "" )
        {   form.bomRevNumber.value = "";
            pa.innerHTML ='<li>'+"Please enter BOM Rev Number";
            return;
        }

        for( var counter = 0 ; counter < bomSize ; counter ++ )
        {
           if( form.bomRevNumber.value.trim().toLowerCase() == bomNum[counter].trim().toLowerCase() )
           {
                pa.innerHTML ='<li>'+"BOM Rev Number already exists cannot be modified";
                return;
           }
        }

        for ( var counter = 0; counter < noOfRows ; counter++ )
        {
            if ( form['bomRevFiles.fileList[' + counter + '].bomRevOrSchemNum'].value.trim().toLowerCase() == form.bomRevNumber.value.trim().toLowerCase() )
            {
                pa.innerHTML ='<li>'+"BOM Rev Number already exists cannot be modified";
                return;
            }
        }
        // Ended by Suresh Yeruva on [26 AUG 2004]

        if ( checkValuesForBoardMaking ()  )
		{
			form.submit();
		}

    }

    // Added by saravnan
    function modifySchemaFiles()
	{
        var pa	= document.getElementById("errors");
		pa.innerHTML = '';
        var form = document.kitMakingForm;
        form.partNumber.disabled=false;
        form.action.value = "ModifySchemFiles";

        if( document.kitMakingForm.schematicFileDetails.value == "---Schematic Files---")
        {
           pa.innerHTML ='<li>'+"Please select a Schematic file to modify from list";
           return;
        }

        // Added By Suresh Yeruva on [26 AUG 2004]
        var noOfRows = form.noOfRowsSchematic.value;
        if( form.schematicNumber.value.trim()  == "" )
        {   form.schematicNumber.value = "";
            pa.innerHTML ='<li>'+"Please enter Schematic Number";
            return;
        }

        for( var counter = 0 ; counter < schemaSize ; counter ++ )
        {
           if( form.schematicNumber.value.trim().toLowerCase() == schemaNum[counter].trim().toLowerCase() )
           {
                pa.innerHTML ='<li>'+"Schematic Number already exists cannot be modified";
                return;
           }
        }

        for ( var counter = 0; counter < noOfRows ; counter++ )
        {
            if ( form['schmaFiles.fileList[' + counter + '].bomRevOrSchemNum'].value.trim().toLowerCase() == form.schematicNumber.value.trim().toLowerCase() )
            {
                pa.innerHTML ='<li>'+"Schematic Number already exists cannot be modified";
                return;
            }
        }
        // Ended by Suresh Yeruva on [26 AUG 2004]

        if ( checkValuesForBoardMaking ()  )
		{
			form.submit();
		}

    }


    function onchangBomRevFiles()
    {
       var bomRevFileDetails = document.kitMakingForm.bomRevFileDetails.value ;

       if( bomRevFileDetails ==  "---BOM Rev Files---" )
       {
         document.kitMakingForm.bomRevNumber.value = "";
       }
       for( var i =0 ; i < bomSize ; i ++ )
        {
           if( bomFileName[i] == bomRevFileDetails )
           {
                document.kitMakingForm.bomRevNumber.value = bomNum[i];
           }
        }
    }

    function onchangSchemaFiles()
    {
       var schematicFileDetails = document.kitMakingForm.schematicFileDetails.value ;

       if( schematicFileDetails == "---Schematic Files---" )
       {
         document.kitMakingForm.schematicNumber.value = "";
       }

       for( var i =0 ; i < schemaSize ; i ++ )
        {
           if( schemaFileName[i] == schematicFileDetails )
           {

               document.kitMakingForm.schematicNumber.value = schemaNum[i];
           }
        }
    }

    function onfocusBomevFile()
    {
        //document.kitMakingForm.bomRevNumber.value = ""; // Commented By Suresh Yeruva on [26 AUG 2004]
        document.kitMakingForm.bomRevFileDetails.value ="---BOM Rev Files---";
    }

    function onfocusSchematicFile()
    {
        //document.kitMakingForm.schematicNumber.value = ""; // Commented By Suresh Yeruva on [26 AUG 2004]
        document.kitMakingForm.schematicFileDetails.value ="---Schematic Files---";
    }

    function selectProcessType()
    {
        var form = document.kitMakingForm;

        if( form.processType.value == '' )
        {
            form.action.value = 'processType';
            form.submit();
            return;
        }

        form.action.value="BoardMaking";
        form.submit();
    }

</SCRIPT>
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<%
    int rowCountBOMRev = 0;
    int rowCountSchematic = 0;
%>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY >
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

    <!-- Side Navigation start -->
    <%@ include file="/jsp/operations/product_menu.jsp" %></TD>
    <!-- end of the side navigations -->

    <TD bgcolor="#ffffff">
    <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%">

    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    <BR>
    <!-- from here your body starts -->
    <!--html:form name="kitMakingForm" type="com.scalar.chiptrack.operations.process.forms.BoardKitForm" action="/kitMaking"-->
	<html:form name="kitMakingForm" action="/kitMaking" method="POST" enctype="multipart/form-data" type="com.scalar.chiptrack.operations.process.forms.BoardKitForm" >

        <input type="hidden" name="action" value="">
        <TABLE width='95%' align=right cellpadding='0' cellspacing='0' border='0'>
            <TR><Td colspan='4' class="NArialW" align=center>Board/Kit Making Entry</td></tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
			<% if ( !user.isActionAllowed ( Functionality.BOARD_KIT_MAKING, User.USER_ACTION_MODIFY  )  ) { %>
			<tr><td colspan='4'>
			<font class='NArialS'><font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b>
			</font></td></tr>
			<% } %>
            <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
            <TR><TD colspan='4'><chiptrack:errors styleClass="NArialL"/></TD></TR>
            <TR><TD colspan='4'><chiptrack:info styleClass="NArialL"/></TD></TR>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <TR>
                <logic:present name="processTypeList" scope="request">
                    <TD width="20%" class="NArialL">Process Type:<font color="RED" size="1"><B> *</B></font></TD>
                    <TD width="30%" class="NArialL">
                        <html:select property="processType" name="kitMakingForm" styleClass="txfield" onchange="selectProcessType()">
                        <html:option value="">Select Process Type</html:option>
                        <html:options collection="processTypeList" property="value" labelProperty="label"/>
                        </html:select>
                    </TD>
                    <logic:present name="Boards" scope="request">
                        <TD width="20%" class='NArialL'  > Select the Board/Kit :<br>
                            (<bean:message key = "label.mfgPartNumber" /><!-- Mfg Part Number -->) </TD>
                        <TD width="30%" class="NArialL" >
                            <html:select property="productId" styleClass="txfield"  onchange="javascript:submitPage('OPEN');" >
                            <html:option value="-1">SELECT Board/Kit</html:option>
                            <html:option value="-2">Add New Board/Kit</html:option>
                            <html:options collection="Boards" property="value" labelProperty="label"/>
                            </html:select>
                        </TD>
                   </logic:present>
                    <logic:notPresent name="Boards" scope="request">
                        <TD width="20%" class="NArialL">&nbsp;</TD>
                        <TD width="30%" class="NArialL">&nbsp;</TD>
                    </logic:notPresent>
                </logic:present>

            </TR>
            <TR><TD colspan='4'>
				<IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'>
			</TD></TR>

			<logic:equal name="showDetails" value="TRUE">
			<TR><TD colspan='3'>
            <TABLE width="100%" border='0'>
            <TR>
                <TD class='NArialL' colspan='1' nowrap="true">Board/Kit Part Number : <font color="RED" size="1"><B> *</B></font></TD>
                <TD class="NArialL" colspan='1'>
					<input type="hidden" name="originalPartNumber" value="<bean:write name='kitMakingForm' property='partNumber'/>">
					<html:text name="kitMakingForm" property="partNumber" styleClass="txfield" maxlength="50" size="20" />
                </TD>

                <TD class='NArialL' colspan='2'>
                   <logic:equal  name="kitActionType"  value="modify">
						<html:radio name="kitMakingForm" property="productType" value="BOARD" disabled="true"/>Board
						&nbsp;&nbsp;&nbsp;&nbsp;
                     <html:radio name="kitMakingForm" property="productType" value="KIT"  disabled="true" />Kit

					</logic:equal>
                     <logic:notEqual  name="kitActionType"  value="modify">
						<html:radio name="kitMakingForm" property="productType" value="BOARD"  />Board
						&nbsp;&nbsp;&nbsp;&nbsp;
						<html:radio name="kitMakingForm" property="productType" value="KIT"  />Kit
					</logic:notEqual>

                </TD>
             </TR>
            <TR>
                <TD class='NArialL'>Description : </TD>
                <TD>
					<html:textarea name="kitMakingForm" property="description" styleClass="txfield" rows="3" cols="30"></html:textarea>
				</TD>
                <TD class='NArialL'>Unit Price : </TD>
                <TD class='NArialL'><table width="100%"><tr><td width="2%" class='NArialL'>$</td><td width="98%" class='NArialL'>
                	<html:text name="kitMakingForm" property="unitPrice" styleClass="valuetxfield" size="18" onkeypress="javascript:restrictCharacters(this,6,2)" onkeyup="javascript:restrictAmt(this,6,2)" maxlength="9"/></td></tr></table>
				</TD>
             </TR>
            <TR>
                <TD class='NArialL'>Is Approved : </TD>
                <TD class="NArialL">
				<html:checkbox name="kitMakingForm" property="isApproved" styleClass="txfield" />
				</TD>
                <TD class='NArialL' colspan="2">&nbsp;</TD>
             </TR>
           <!--  <TR>
                <TD class='NArialL'>PCB Rev NO: </TD>
                <TD class="NArialL">
                	<html:text name="kitMakingForm" property="pcbRevNo" styleClass="txfield" maxlength="50" size="20" />
				</TD>
                <TD class='NArialL' colspan="2">&nbsp;</TD>
             </TR>
 -->
            <!-- view of BOM dcouments starts ------------------------------------------------------------  -->
            <!-- modifed by saravnan -->
            <!--************* start ***********
            <TR>
              <TD  colspan="4" align=left >
				<table border ="0" width="100%"  >
                    <tr>
						<TD colspan="6" class="NArialL"  width="40%" height="40">
				           <img border="0" src="<%=chipTracContext%>/jsp/includes/images/exclamation-46x47.gif"  WIDTH="20" HEIGHT="20">
                           <font class="NArialL">Please select file along with BomRev Number and click Attach to add a file </font>	</TD>
					</tr>

					<tr>
						<TD class='NArialL' width="22%" align= left valign=top>BOM Rev:</TD>
						<TD colspan="2" class='NArialL' width="25%" valign=top nowrap>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
                            <html:file name="kitMakingForm" property="bomRevNo" styleClass="txfield" size="10" onfocus="javascript:onfocusBomevFile()" />
                            <html:hidden name="kitMakingForm" property="bomRevId" />
							&nbsp;<a href='javascript:addBomFiles()'onMouseOver="window.status='Click to Add a File';return true"onmouseout="window.status='';return true">Attach</a>
						</TD>

						<TD colspan="3" class="NArialL" width="40%"></TD>
					</tr>
                    <tr>
						<TD class='NArialL' width="22%" align= left valign=top>BOM Rev Number:</TD>
						<TD colspan="5" class='NArialL' width="25%"  valign=top>
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                           	<html:text name="kitMakingForm" property="bomRevNumber" styleClass="txfield" maxlength="50" size="20" />

                        </TD>
					</tr>
                   <tr>
                       <logic:present name="BomRevFileDetailsList" >
						<TD class='NArialL' width="22%" valign=top> Files to be uploaded:</TD>
						<TD colspan="5" class='NArialL' width="25%"  valign=top>
							    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
                                 <html:select property="bomRevFileDetails" styleClass="txfield" onchange="javascript:onchangBomRevFiles()">
                                    <html:option value="---BOM Rev Files---"/>
        					        <html:options collection="BomRevFileDetailsList"  property="label" labelProperty="label" />
		            			</html:select>&nbsp;<a href='javascript:modifyBomRevFiles()' onMouseOver="window.status='Click to Modify the File';return true"onmouseout="window.status='';return true">Modify</a> &nbsp;&nbsp; <a href='javascript:removeBomRevFiles()' onMouseOver="window.status='Click to Remove the file';return true"onmouseout="window.status='';return true">Remove</a>
						</TD>
                      </logic:present>
					</tr>
                     <tr>
                        <td colspan="7" width="40%"  height="30" class='NArialL' > </td>
                    </tr>
                     <logic:equal name="BomRevListSize" value="1">
                     <nested:nest property="bomRevFiles" >
                    <TR>
                         <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL" align="center">
                        <TR>
                            <TD WIDTH="50%" BGCOLOR="#993333">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">Uploaded BomRev File</FONT></SPAN></B>
                            </TD>
                            <TD WIDTH="30%" BGCOLOR="#993333">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px" align="center" ><FONT COLOR="white">BOM Rev Number</FONT></SPAN></B>
                            </TD>
                            <TD WIDTH="20%" BGCOLOR="#993333" align="center">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px" align="center"><FONT COLOR="white">Delete</FONT></SPAN></B>
                            </TD>
                        </TR>
                         <nested:iterate property="fileList" >
                        <TR>
                            <logic:equal  name="kitMakingForm" property="productType" value="BOARD">
                            <TD WIDTH="50%" bgcolor='#DEE1E2'>
                             &nbsp;&nbsp;  <a align=center href = '<%=chipTracContext%><%=ConfigManager.getBoardBomLocationContext()%>/<nested:write property="filename"/>'  target="_blank" title="Please right-click & choose Save target as">
                                    <nested:write name="kitMakingForm" property="filename"/>
                                    <nested:hidden name="kitMakingForm" property="filename"/>
                            </TD>
                            </logic:equal>

                            <logic:equal name="kitMakingForm" property="productType" value="KIT">
                            <TD WIDTH="50%" bgcolor='#DEE1E2'>
                             &nbsp;&nbsp;  <a align=center href = '<%=chipTracContext%><%=ConfigManager.getKitBomLocationContext()%>/<nested:write property="filename"/>'  target="_blank" title="Please right-click & choose Save target as">
                                    <nested:write name="kitMakingForm" property="filename"/>
                                    <nested:hidden name="kitMakingForm" property="filename"/>
                            </TD>
                            </logic:equal>

                            <TD WIDTH="30%" bgcolor='#DEE1E2' align="center" >
                                 &nbsp;&nbsp;  <nested:text  property="bomRevOrSchemNum" styleClass="txfield" maxlength="50" size="20" disabled="true"/>
                            </TD>
                            <TD WIDTH="20%" bgcolor='#DEE1E2' align="center">
                             &nbsp;&nbsp; <nested:checkbox name="kitMakingForm" property="isFileDelete" styleClass="txfield"  /><br>
                              <nested:hidden name="kitMakingForm" property="docID"/>
                            </TD>
                        </TR>
                        <% rowCountBOMRev++; %>
                       </nested:iterate>
     			    <tr>
                    </nested:nest>
                     </logic:equal>
					<td colspan="6" class="NArialL" colspan="4" width="20%" align=right>
                    </td>
				  <tr>
				</table>
				</TD>
            </TR>-->
            <!-- view of BOM dcouments starts ------------------------------------------------------------  -->

            <!-- view of Schematic dcouments starts ------------------------------------------------------------  -->
			<!-- COMMENTED THE WHOLE THING AS DONE SPECIFIC TO AIRGO>
            <TR>
              <TD colspan="4">
				<table border ="0" width="100%"> 
                     <tr>
						<TD colspan="6" class="NArialL"  width="40%" height="40">
                            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/exclamation-46x47.gif"  WIDTH="20" HEIGHT="20">
                           <font class="NArialL">Please select file along with Schematic Number and click Attach to add a file </font>	</TD>
					</tr>

                    <tr>
						<TD class='NArialL' width="22%" align= left valign=top>Schematic: </TD>
						<TD colspan="2" class='NArialL' width="25%" valign=top nowrap>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <html:file name="kitMakingForm" property="schematic" styleClass="txfield" size="10" onfocus="javascript:onfocusSchematicFile()" />
							&nbsp;<a href='javascript:addSchemFiles()' onMouseOver="window.status='Click to Add a File';return true"onmouseout="window.status='';return true">Attach</a><FONT id="font3"></FONT>

						</TD>

						<TD colspan="3" class="NArialL" width="40%"></TD>
					</tr>
                    <tr>
						<TD class='NArialL' width="22%" align= left valign=top>Schematic Number: </TD>
						<TD colspan="5" class='NArialL' width="25%"  valign=top>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<html:text name="kitMakingForm" property="schematicNumber" styleClass="txfield" maxlength="50" size="20" />
							<html:hidden name="kitMakingForm" property="schematicId" />
                        </TD>
					</tr>

                    <tr>
                       <logic:present name="SchemaFileDetailsList" >
						<TD class='NArialL' width="22%"  valign=top> Files to be uploaded: </TD>
						<TD colspan="5" class='NArialL' width="25%"  valign=top>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					             <html:select property="schematicFileDetails" styleClass="txfield" onchange="javascript:onchangSchemaFiles()">
                                    <html:option value="---Schematic Files---"/>
        					        <html:options collection="SchemaFileDetailsList"  property="label" labelProperty="label" />
		            			</html:select>&nbsp;<a href='javascript:modifySchemaFiles()' onMouseOver="window.status='Click to Modify the File';return true"onmouseout="window.status='';return true">Modify</a> &nbsp;&nbsp; <a href='javascript:removeSchemaFiles()' onMouseOver="window.status='Click to Remove the File';return true"onmouseout="window.status='';return true">Remove</a>
						</TD>
                      </logic:present>
					</tr>
                    <tr>
                       	<TD class='NArialL' width="22%" valign=top> </TD>
                        <TD class='NArialL' width="28%" valign=top> </TD>
                        <td colspan="4" width="40%" class='NArialL' > </td>
                    </tr>

                     <tr>
                        <td colspan="6" width="40%"  height="30" class='NArialL' > </td>
                    </tr>
                      <logic:equal  name="SchemaListSize"  value="1">
                     <nested:nest  property="schmaFiles" >
                     <TR>
                         <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL" align="center">
                        <TR>
                            <TD WIDTH="50%" BGCOLOR="#993333">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">Uploaded Schematic File</FONT></SPAN></B>
                            </TD>
                            <TD WIDTH="30%" BGCOLOR="#993333">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px" align="center" ><FONT COLOR="white">Schematic Number</FONT></SPAN></B>
                            </TD>
                            <TD WIDTH="20%" BGCOLOR="#993333" align="center">
                            <P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px" align="center"><FONT COLOR="white">Delete</FONT></SPAN></B>
                            </TD>
                        </TR>
                         <nested:iterate property="fileList" >
                        <TR>
	                        <logic:equal name="kitMakingForm" property="productType" value="BOARD">
                            <TD WIDTH="50%" bgcolor='#DEE1E2'> &nbsp;&nbsp;
                               <a align=center href = '<%=chipTracContext%><%=ConfigManager.getBoardSchematicLocationContext()%>/<nested:write property="filename"/>'  target="_blank" onMouseOver="window.status='Please right-click & choose Save target as';return true"onmouseout="window.status='';return true" title="Please right-click & choose Save target as">
                                   <nested:write name="kitMakingForm" property="filename"/>
                                   <nested:hidden name="kitMakingForm" property="filename"/>
                            </TD>
                            </logic:equal>

	                        <logic:equal name="kitMakingForm" property="productType" value="KIT">
                            <TD WIDTH="50%" bgcolor='#DEE1E2'> &nbsp;&nbsp;
                               <a align=center href = '<%=chipTracContext%><%=ConfigManager.getKitSchematicLocationContext()%>/<nested:write property="filename"/>'  target="_blank" onMouseOver="window.status='Please right-click & choose Save target as';return true" onmouseout="window.status='';return true" title="Please right-click & choose Save target as">
                                   <nested:write name="kitMakingForm" property="filename"/>
                                   <nested:hidden name="kitMakingForm" property="filename"/>
                            </TD>
                            </logic:equal>

                            <TD WIDTH="30%" bgcolor='#DEE1E2' align="center">
                               &nbsp;&nbsp;    <nested:text property="bomRevOrSchemNum" styleClass="txfield" maxlength="50" size="20" disabled="true"/>
                            </TD>
                            <TD WIDTH="20%" bgcolor='#DEE1E2' align="center">
                            &nbsp;&nbsp;  <nested:checkbox name="kitMakingForm" property="isFileDelete" styleClass="txfield"  /><br>
                              <nested:hidden name="kitMakingForm" property="docID"/>
                            </TD>
                        </TR>
                        <% rowCountSchematic++; %>
                       </nested:iterate>
        			    <tr>
                    </nested:nest>
                    </logic:equal>
                   <%--     <logic:iterate name="kitMakingForm" property="schematicFileNames" id="schematicFileName">
								<logic:equal  name="kitMakingForm" property="productType" value="BOARD">
									<a align=center href = '<%=chipTracContext%><%=ConfigManager.getBoardSchematicLocationContext()%>/<bean:write name="schematicFileName"/>'  target="_blank" title="Please right-click & choose Save target as">
									<bean:write name="schematicFileName"/>
									</a>
								</logic:equal>
								<logic:equal  name="kitMakingForm" property="productType" value="KIT">
									<a align=center href = '<%=chipTracContext%><%=ConfigManager.getKitSchematicLocationContext()%>/<bean:write name="schematicFileName"/>'  target="_blank" title="Please right-click & choose Save target as">
									<bean:write name="schematicFileName"/>
									</a>
								</logic:equal>

								<logic:notEmpty name="kitMakingForm" property="schematicFileNames" >
									&nbsp;
									Delete
									<html:checkbox name="kitMakingForm" property="isSchematicDelete" styleClass="txfield" /><br>
								</logic:notEmpty>
						 </logic:iterate>  --%>
           
					    </td>
				    <tr>
				</table>
			  </TD>
            <TR>-->
			<tr><td> &nbsp;</td></tr>
            <TR>
                <TD class='NArialL'>Product Options: </TD>
                <TD class='NArialL' colspan="3">&nbsp;</TD>
            </TR>
			<% int childCount = 1; %>
			<logic:equal name="blankChild" value="TRUE">
			<logic:iterate name="kitMakingForm" property="childBoard" id="childBoards" type="com.scalar.chiptrack.operations.process.BoardMaking">
            <TR>
                <TD class='NArialL'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Child Board/Kit <%=childCount%>: </TD>
                <TD class='NArialL'>
					<html:text name="childBoards" property="childBoardName" styleClass="txfield" maxlength="20" size="20" />
					<html:hidden name="childBoards" property="childProductId" />
					<html:hidden name="childBoards" property="originalChildBoardName" />
				</TD>
                <TD class="NArialL" colspan="2">&nbsp;</TD>
             </TR>
			 <% childCount++; %>
			 </logic:iterate>
			</logic:equal>
			<% childCount = 1; %>
			<logic:notEqual name="blankChild" value="TRUE">

                <logic:iterate name="kitMakingForm" property="childBoard" id="childBoards" type="com.scalar.chiptrack.operations.process.BoardMaking">
                <TR>
                    <TD class='NArialL'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Child Board/Kit <%=childCount%>: </TD>
                    <TD class='NArialL'>
                        <%if( Constants.FINANCE_INTEGRATION_TYPE_GREAT_PLAINS.equalsIgnoreCase( ConfigManager.getFinanceIntegrationType() ) )
                        {%>
                            <html:text name="childBoards" property="childBoardName" styleClass="txfield" maxlength="20" size="20" disabled = "true" />
                        <%}else{%>
                            <html:text name="childBoards" property="childBoardName" styleClass="txfield" maxlength="20" size="20"   />
                        <%}%>
                        <html:hidden name="childBoards" property="childProductId" />
                        <html:hidden name="childBoards" property="originalChildBoardName" />
                    </TD>
                    <TD class="NArialL" colspan="2">&nbsp;</TD>
                 </TR>
                 <% childCount++; %>
                 </logic:iterate>

			</logic:notEqual>
			<!--end of Bhaskar Saravanan added/placed this block again for testing remove later-->

			<TR><TD colspan="4"><FONT id="font1"></FONT></TD></TR>
			<TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <TR><TD colspan='4' align="center">
				<a href='javascript:addChildBoards()'><IMG src='<%=chipTracContext%>/jsp/includes/images/addmore.gif' border=0 width="60" height="17" onMouseOver="window.status='Click to Add more Child Boards';return true"onmouseout="window.status='';return true" title="Click here to Add more Child Boards"></a>
			</TD></TR>
			 <!--Bhaskar's addition for new Board Kit Making ends here 14 Feb 2004-->
            <TR>
				<TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD>
			</TR>
             <TR><TD colspan='4'>
                <table width="80%" border='10' bordercolor="#FFFFFF">
                    <tr><td class="NArialL" height="18" colspan=3>Vendor Location Information :<font color="RED" size="1"><B>*</B></font></td></tr>
                    <tr>
                        <td width="10%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Select</font></td>
                        <td width="10%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Priority</font></td>
                        <td width="80%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Location</font></font></td>
                    </tr>
					<%int idd = 0;%>
					<logic:iterate name="kitMakingForm" property="vendorLocations" id="vendors" type="com.scalar.chiptrack.operations.process.VendorLocation" indexId="chkCount">
                        <tr>
                            <td width="20%" align="center" bgcolor="#DEE1E2"
							height="1"><font class="NArialL">
							<font color="#FFFFFF">
							<%
							String str = "checkLocation("+ chkCount +")";
							%>
							<html:checkbox name="vendors" property="select" styleClass="txfield" onclick="<%=str%>" />
							</font></font></td>
                            <td width="20%" align="center" bgcolor="#DEE1E2" height="1">
							<font class="NArialL" color="#FFFFFF">
							<logic:equal name="vendors" property="select" value="on">
							<html:text name="vendors" property="priority" size="6" maxlength="4" styleClass="txfield" disabled="true" />
							</logic:equal>
							<logic:notEqual name="vendors" property="select" value="on">
							<html:text name="vendors" property="priority" size="6" maxlength="4" styleClass="txfield" value="" disabled="true" />
							</logic:notEqual>
							</font></td>
                            <td width="60%" align="center" bgcolor="#DEE1E2" height="1"><font class="NArialL"><font color="#FFFFFF">
                                <html:text name="vendors" property="locationName" disabled="true" size='40' styleClass="txfield" />
                                <html:hidden name="vendors" property="locationID" />
							</font></font></td>
                        </tr>
					<% idd++; %><!--Very important please dont delete.-->
					</logic:iterate>
                </table></TD>
             </TR>
             </TABLE>
             </TD></TR>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
             <TR><TD colspan='4' align=center>
					<chiptrack:restrictedLink functionality='<%=Functionality.BOARD_KIT_MAKING%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('SAVE');" onmouseover="window.status='Click to save Board or Kit details';return true" onmouseout="window.status='';return true">
					<img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" title="Click here to save Board or Kit details"></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <A HREF="javascript:document.kitMakingForm.reset();"><IMG src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border=0 onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></A>
                 </TD>
              </TR>
			 <input type="hidden" name="count" value="<%=idd%>">
             <html:hidden name="kitMakingForm" property="processStepId" />
			</logic:equal>
			</TABLE>
            <input type="hidden" value = "<%=rowCountBOMRev%>" name = "noOfRowsBOMRev"/>
            <input type="hidden" value = "<%=rowCountSchematic%>" name = "noOfRowsSchematic"/>
   </html:form>

<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>
